package niuke;

import java.util.Scanner;

public class 优雅的点 {
    static int r;
    static long result=0;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        r = scanner.nextInt();
        int l = (int) Math.sqrt(r);
        boolean flag = (l*l)==(r) ? true : false;
        f(r,l,flag);
        System.out.println(result);
    }

    public static void f(int r,int l,boolean flag){
        int h = 0;
        int l2 = l;
        result = flag ? 1 : 0;
        while (h<=l2){
            h++;
            //去除出局的点
            for(int i=l;i*i+h*h>r && i>=0;i--){
                l--;
            }
            //判断是否在圆上
            if(l*l + h*h == r){
                result ++;
                System.out.println(l+" "+h);
            }
        }
        result = 4*result - 4*(flag?1:0);
    }
}
